﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using CourseSystem.Common.Helpers;
using Chowpoo.Util;
namespace CourseSystem.Common
{
    public class BaseController : Controller
    {
        public void SetAlertMsg(string msg, bool tempDate = false)
        {
            if (tempDate)
                TempData["AlertMsg"] = msg;
            else
                ViewData["AlertMsg"] = msg;
        }

        public void SetHighLineMsg(string msg)
        {
            ViewData["Msg"] = msg;
        }

        public void SetErrorMsg(string msg)
        {
            ViewData["errorMsg"] = msg;
        }

        public ActionResult NotFound()
        {
            var alertMsg = ViewData["errorMsg"].CheckStr("您没有浏览该模块的权限!");
            System.Web.HttpContext.Current.Session["errorMsg"] = alertMsg;
            return new RedirectResult(UserHelper.NotAuthUrl());

            /* return View();
            return View("NotFound");*/
        }
    }
}
